<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
		<title>{:C('WEB_SITE_TITLE')}</title>
		<link rel="stylesheet" href="__PUBLIC__/Home/css/common.css">
		<link rel="stylesheet" href="__PUBLIC__/Home/css/main.css">
		<script src="__PUBLIC__/Home/js/zepto.js"></script>
		<script src="__PUBLIC__/Home/js/delIOS_huitan.js"></script>
	</head>
	<body class="box">
		<!--提示文字--> 
		<div class="tip" style="opacity: 0;z-index: -1"></div>
		<!--输入验证码的弹框-->
		<div id="maKuang" style="display:none">
			<div class="top">
				<span class="title">输入验证码</span>
				<div class="inputArea">
					<input type="text" />
					<p class="ma">
						<!-- <img src="img/login/yz.jpg" /> -->
					</p>
				</div>
			</div>
			<div class="bot">
				<a href="javascript:;" class="cancel">取消</a><a href="javascript:;" class="sure">确认</a>
			</div>
		</div>
		<!--提交过申请的 提示对话框-->
		<div id="shenQingTipKuang" style="display: none">
			<p class="title">提示</p>
			<p class="info">您已提交申请，请等待审核
			</p>
		</div>
		<!--遮罩层-->
		<div id="zhezhao" style="display:none"></div>
		<!--正文区域-->
		<div id="tixianShenqingTop" class="topBackTitle">
			<div class="contain maxWidth">
				<a class="hz back" href="{:U('Index/index')}">&#xe600;</a>提现申请
			</div>
		</div>
		<div id="tixianShenqingMain" class="fastscroll top50bot0">
			<div class="contain maxWidth">
				<!--
				<div class="tab">
					<a href="javascript:;" class="left active">从余额中提现
					</a>
					<a href="javascript:;" class="right">从佣金中提现
					</a>
				</div>
				-->
				<div class="yinhang">
					<a href="__URL__/selectbank">
						<div class="left">
							<div class="l">
								<img src="/Public/Home/{$banktype.img}">
							</div>
							<div class="r">
								<div class="title">{$banktype.title}</div>
								<div class="info">尾号{:substr($bank['card_num'],-4)}</div>
							</div>
						</div>
						<div class="right"><span class="hz">&#xe60c;</span></div>
					</a>
				</div>
				<div class="yinhanginfo">
					<span class="hz left">&#xe62e;</span>
					<p class="right"><span class="startTime">00:00:00</span>-<span class="endTime">23:59:59</span>期间申请，提现金额最小为{$limit}元，申请完成后，等待审核通过。</p>
				</div>
				<input type="hidden" id="bank_id" value="{$bank.id}" />
				<div class="tixianMoney">
					<div class="left">
						提现金额
					</div>
					<div class="right">
						<input type="text" id="money" placeholder="请输入整数提现金额" onkeyup="this.value=this.value.replace(/\D/g,'')" >
						<div class="circle">
							<span class="hz">&#xe625;</span>
						</div>
					</div>
				</div>
				<!--
				<div class="shuruMaInfo">
					请输入<span class="tel">13854966554</span>收到的验证码
				</div>
				<div class="yanzhangma">
					<div class="left">
						验证码
					</div>
					<div class="center">
						<input type="text" placeholder="请输入验证码">
					</div>
					<a href="javascript:;" class="right">获取验证码</a>
				</div>
				-->
				<a href="javascript:;" class="orangeBtn">提交申请</a>
			</div>
		</div>

		<script>
			//返回按钮
			/*$('#tixianShenqingTop .back').on('tap',function(){
				window.history.go(-1);
			});*/

			//点击tab 切换
			$('#tixianShenqingMain .tab a').on('tap',function(){
				if($(this).hasClass('active')){
					$(this).removeClass('active');
					$(this).siblings().addClass('active');
				}else{
					$(this).addClass('active');
					$(this).siblings().removeClass('active');
				}
			});

			//点击获取验证码
			$('#tixianShenqingMain .yanzhangma .right').on('tap',function(){
				$('#maKuang').css('display','block');
				$('#zhezhao').css('display','block');
			});

			//点击取消
			$('#maKuang .bot .cancel').on('tap',function(){
				$('#maKuang .top .inputArea input').val('');//清空弹框input值
				$('#maKuang').css('display','none');
				$('#zhezhao').css('display','none');
			});

			//点击确定
			$('#maKuang .bot .sure').on('tap',function(){
				var getValue=$('#maKuang .top .inputArea input').val();
				console.log(getValue);
				$('#maKuang .top .inputArea input').val('');//清空弹框input值
				$('#maKuang').css('display','none');
				$('#zhezhao').css('display','none');
			});

			//点击 提交申请
			var openShengqingTip=false;//弹出了申请提示对话框后为true
			$('#tixianShenqingMain .orangeBtn').on('tap',function(){
				//如果已经提交过了，则弹出提示对话框
				var money=$('#money').val();
				var limit = {$limit};
				if(money=='')
				{
					tipFun('请输入提现金额');
				}
				else if(money<limit)
				{
					tipFun('提现金额不能小于'+limit+'元');
				}
				else
				{
					$.ajax({  
						type:'post',  
						traditional :true,  
						url:"{:U('Index/withdraw')}",  
						data:{'bank_id':$('#bank_id').val(),'money':money},  
						success:function(data){
							if(data.status==0)
							{
								tipFun(data.info);
							}
							else
							{
								$('#shenQingTipKuang').css('display','block');
								$('#zhezhao').css('display','block');
								openShengqingTip=true;
								setTimeout(function(){
									location.href = "{:U('Index/withdrawlist')}";
								},1200);
							}
						}  
					});
				}
			});

			//弹出申请提示框 后点击遮罩可以关闭弹框
			$('#zhezhao').on('tap', function () {
				if(openShengqingTip){
					$('#shenQingTipKuang').css('display','none');
					$('#zhezhao').css('display','none');
					openShengqingTip=false;
				}
			});

			//点击x
			$('#tixianShenqingMain .tixianMoney .right .circle').on('tap',function(){
				$('#tixianShenqingMain .tixianMoney .right input').val('');
			});

			//电话号码处理成，带有*****
			// var tel=$('#tixianShenqingMain .shuruMaInfo .tel')[0];
			// var reg=/(\d{3})(\d{5})(\d{3})/;
			// tel.innerHTML=tel.innerHTML.replace(reg,'$1*****$3');

			//tip
			function tipFun(str){
				$('.tip').text(str).css({
					'opacity':'1',
					'z-index':'9999'
				});
				setTimeout(function(){
					$('.tip').css('opacity','0');
					setTimeout(function(){
						$('.tip').css('z-index','-1');
					},300);
				},1300);
			}
		</script>
	</body>
</html>
